﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using Library.Common;
using Library.Bll;
namespace HanhuaMicroCredit.Admin.Controllers
{
    public class UserAuthenController : Controller
    {
        public bool IsAuthenticated { get; set; }

        public UserAuthenController() {
            
        }
        public UserAuthenController(System.Web.Routing.RequestContext requestContext) {
            this.IsAuthenticated = UIdentity.Instance.IsAuthenticated;
            this.Initialize(requestContext);
        }
        protected override void Initialize(System.Web.Routing.RequestContext requestContext)
        {
            base.Initialize(requestContext);

            //未登录
            if (!Current.IsAuthorizedUser())//cookie
            {
                string returnUrl = MyRequest.AppPath + "/Login/?returnUrl=" + HttpUtility.UrlEncode(MyRequest.GetCurrentHost() + MyRequest.GetRawUrl());
                System.Web.HttpContext.Current.Response.Redirect(returnUrl);
            }
            //权限控制
        }
    }
}
